package Classes.GameViews.ViewPanels
{
	import Classes.GameDatas.GD_Player;
	import Classes.GameViews.ViewScenes.VS_Main;
	import Classes.Managers.M_Communication;
	import Classes.Managers.M_ConfigData;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	import flash.system.ApplicationDomain;

	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Apr 24, 2012 11:42:35 AM 
	 */ 
	public class VP_NewQQVip extends ViewPanel
	{
		private static var _instance:VP_NewQQVip;
		private var _interfaceUI:Sprite;
		
		public function VP_NewQQVip()
		{
			this.init();
		}
		
		private function init():void
		{
			this._interfaceUI=new (ApplicationDomain.currentDomain.getDefinition("NewVipQQ_v") as Class);
			this.addChild(this._interfaceUI);
			this.addListener();
		}
		
		private function addListener():void
		{
			this.addEventListener("customCallBack",customHandler);
			this.addEventListener("close",closeHandler);
			this.addEventListener("openNewqqVip",kthzfun);
		}
		
		private function kthzfun(e:Event):void
		{
			navigateToURL(new URLRequest(M_ConfigData.instance.qqVipLink));
		}
		
		private function customHandler(e:Event):void
		{
			//领取
			M_Communication.instance.send(11004,{type:1});
		}
		
		public function closeHandler(e:Event):void
		{
			this.close();
		}
		
		/**
		 * 打开
		 */	
		public function openNewVipWindon(arr:Array):void
		{
			var flag:Boolean=GD_Player.instance.qqVipId==0?true:false;
			this._interfaceUI["contorlHzBtn"](flag);
			this._interfaceUI["setInfo"](arr);
			this.openAt(VS_Main.instance,true);
			this.toCenter();
		}
		
		public static function get instance():VP_NewQQVip
		{
			if(!_instance)_instance=new VP_NewQQVip();
			return _instance;
		}
		
		public function get interfaceUI():Sprite
		{
			return _interfaceUI;
		}
	}
}
